package com.yss.reportworld.api.factory;

import com.yss.common.core.domain.YssResponse;
import com.yss.reportworld.api.RemoteCustomerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * 检查报表世界基础数据
 */
@Component
public class RemoteCustomerFallbackFactory implements FallbackFactory<RemoteCustomerService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteCustomerFallbackFactory.class);

    @Override
    public RemoteCustomerService create(Throwable throwable) {
        log.error("报表世界客户信息服务调用失败:{}", throwable.getMessage());
        return new RemoteCustomerService() {
            @Override
            public YssResponse<String> queryLicenseDueTime(String source) {
                return YssResponse.fail("查询客户许可到期时间失败:" + throwable.getMessage());
            }
        };
    }
}
